// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 .
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : ppu_cov.sv
// Author        : 
// Created On    : 
// Last Modified : 2022-11-30 12:54 by gaojiaming
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

`ifndef __PPU_COV_SV__
`define __PPU_COV_SV__

class ppu_cov extends uvm_subscriber #(spt_transaction);
	`uvm_component_utils(ppu_cov)

    covergroup ppu_cg(input int max = 2000, input int min=1) with function sample(spt_transaction tr);
        tr_long: coverpoint tr.pkt_len {
            bins glitch = {[min: 2]};
            bins short  = {[3: 21]};
            bins normal = {[22: 602]};
            bins long   = {[603: max]};
        }
    endgroup

    extern function new(string name = "ppu_cov", uvm_component parent=null);
    extern function void write(spt_transaction t);
    
endclass: ppu_cov

function ppu_cov::new(string name = "ppu_cov", uvm_component parent=null);
	super.new(name, parent);
    ppu_cg = new();
    ppu_cg.set_inst_name({get_full_name(), "ppu_cg"});
endfunction: new

function void ppu_cov::write(spt_transaction t);
    ppu_cg.sample(t);
endfunction: write

`endif
